import numpy as np
# 创建向量 1
arr1 = np.array([1,2,3])
print(arr1)
# 创建向量 2
arr2 = np.array([4,5,6])
print(arr2)
# 拼接
arr3 = np.concatenate([arr1,arr2])
print(arr3) # [1 2 3 4 5 6]


# 矩阵的拼接
# 创建数组 1
arr1 = np.array([[1,2,3],[4,5,6]])
print(arr1)
"""
[[1 2 3]
 [4 5 6]]
"""
# 创建数组 2
arr2 = np.array([[7,8,9],[10,11,12]])
print(arr2)
"""
[[ 7  8  9]
 [10 11 12]]
"""
# 按第一个维度（行）拼接
# arr3 = np.concatenate([arr1,arr2], axis=0)
arr3 = np.concatenate([arr1,arr2])
print(arr3)
"""
[[ 1  2  3]
 [ 4  5  6]
 [ 7  8  9]
 [10 11 12]]
"""
# 按第二个维度（列）拼接
arr4 = np.concatenate([arr1,arr2],axis=1)
print(arr4)
"""
[[ 1  2  3  7  8  9]
 [ 4  5  6 10 11 12]]
"""
